#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPen>
#include <QTableWidget>
#include "qcustomplot.h"
#include "vec3.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    bool event(QEvent *mEvent);
    QTableWidget* table, *splineTable;

    double computeNext(double x, double v, double h, double (*f)(double,double));
    void computeNextForSystem(const double x, const double v, const double vDer, const double h,
                                          double (*f1)(double,double, double),
                                          double (*f2)(double,double, double),
                                          double & vNext, double& vDerNext);
    void plotFunc2(QVector<double>& x,  QVector<double>& y, QCustomPlot* holst,QPen color = QPen(Qt::blue), QString xlabel="x", QString ylabel="y");
    void computeNextForSystemRK4(const double x, const vec3 v, const double h,
                                          vec3 & vNext);
    explicit MainWindow(QWidget *parent = 0);
    vec3 fLab(double x, vec3 v);
    ~MainWindow();

private slots:

    void on_pushButton_clicked();
    void updateStability();

private:
    Ui::MainWindow *ui;
    QCustomPlot* difference;
    QCustomPlot* phasePortrait;
    QCustomPlot* x_vDer;
};

#endif // MAINWINDOW_H
